/*
@author https://yunp.top
 */
@file:JsQualifier("createjs")

package createjs

open external class EventDispatcher {
    fun addEventListener(type: String, listener: (event: Event) -> Unit, useCapture: Boolean = definedExternally)

    fun dispatchEvent(
        event: Event,
        bubbles: Boolean = definedExternally,
        cancelable: Boolean = definedExternally
    ): Boolean

    fun dispatchEvent(
        event: String,
        bubbles: Boolean = definedExternally,
        cancelable: Boolean = definedExternally
    ): Boolean

    fun hasEventListener(type: String): Boolean

    fun off(type: String, listener: (event: Event) -> Unit, useCapture: Boolean = definedExternally)

    fun on(
        type: String,
        listener: (event: Event) -> Unit,
        scope: dynamic = definedExternally,
        once: Boolean = definedExternally,
        data: dynamic = definedExternally,
        useCapture: Boolean = definedExternally
    )

    fun removeAllEventListeners(type: String)

    fun removeEventListener(
        type: String,
        listener: (event: Event) -> Unit,
        useCapture: Boolean = definedExternally
    )

    fun willTrigger(type: String): Boolean
}